const News = {
  // 查询数据
  selectData(option) {
    return `select * from news`
  },

  //  查询详情页
  selectDetail(id) {
    return `select * from news where id=${id}`
  },

  // 插入数据库
  insertData(obj) {
    return `INSERT INTO news ( title, detail,pic,time) VALUES("${obj.title}",'${obj.des}','${obj.pic}',CURRENT_TIMESTAMP) `
  },

  // 插入图片
  insertPic(id, img) {
    return `insert into picnews(pic_news_id,pic_src) values('${id}','${img}')`
  },

  // 查询图片
  selectPic(id) {
    return `select * from picnews where pic_news_id =${id}`
  },

  // 删除图片
  delPics(id) {
    return `DELETE FROM picnews WHERE pic_news_id =${id};`
  },

  // 删除主表
  delNews(id) {
    return `DELETE FROM news WHERE id =${id};`
  },
}

exports = module.exports = News
